﻿@model Product

@{
    ViewData["Title"] = "编辑商品信息";
}

<h2>@ViewData["Title"]</h2>

<form asp-action="Edit" enctype="multipart/form-data">
    <input type="hidden" asp-for="Id" />

    <div class="row">
        <div class="col-md-6">
            <div asp-validation-summary="ModelOnly" class="text-danger"></div>

            <div class="form-group mb-3">
                <label asp-for="ProductNo" class="control-label"></label>
                <input asp-for="ProductNo" class="form-control" />
                <span asp-validation-for="ProductNo" class="text-danger"></span>
            </div>

            <div class="form-group mb-3">
                <label asp-for="Name" class="control-label"></label>
                <input asp-for="Name" class="form-control" />
                <span asp-validation-for="Name" class="text-danger"></span>
            </div>

            <div class="form-group mb-3">
                <label asp-for="Supplier" class="control-label"></label>
                <input asp-for="Supplier" class="form-control" />
                <span asp-validation-for="Supplier" class="text-danger"></span>
            </div>

            <div class="form-group mb-3">
                <label asp-for="Stock" class="control-label"></label>
                <input asp-for="Stock" class="form-control" />
                <span asp-validation-for="Stock" class="text-danger"></span>
            </div>

            <div class="form-group mb-3">
                <label asp-for="LimitStock" class="control-label"></label>
                <input asp-for="LimitStock" class="form-control" />
                <span asp-validation-for="LimitStock" class="text-danger"></span>
            </div>

            <div class="form-group mb-3">
                <label asp-for="Price" class="control-label"></label>
                <input asp-for="Price" class="form-control" />
                <span asp-validation-for="Price" class="text-danger"></span>
            </div>

            <div class="form-group mb-3">
                <label asp-for="ProduceDate" class="form-label"></label>
                <input asp-for="ProduceDate" type="date"
                       class="form-control"
                       max="@DateTime.Now.ToString("yyyy-MM-dd")">
                <span asp-validation-for="ProduceDate" class="text-danger"></span>
            </div>

            <div class="form-group mb-3">
                <label asp-for="QualityPeriod" class="form-label"></label>
                <input asp-for="QualityPeriod" type="number"
                       class="form-control" />
                <span asp-validation-for="QualityPeriod" class="text-danger"></span>
            </div>

            <div class="form-group mb-3">
                <label class="control-label">当前图片</label>
                @if (!string.IsNullOrEmpty(Model.Image))
                {
                    <div class="mb-2">
                        <img src="@Model.Image" class="img-thumbnail" style="max-width: 200px;" />
                    </div>
                }
                <input type="file" name="imageFile" class="form-control" />
            </div>

            <div class="form-group">
                <button type="submit" class="btn btn-primary">保存修改</button>
                <a asp-action="Index" class="btn btn-secondary">返回列表</a>
            </div>
        </div>
    </div>
</form>